package com.iplant.ams.service.po.dms.fault;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.ams.service.basicenum.dms.DMSFaultType;
import com.iplant.ams.service.basicenum.dms.DMSRepairRecordStatus;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.util.Calendar;

/**
 * 设备检修履历（弃用）
 *
 * @author YouWang·Peng
 * 2023-8-31 14:45:41
 */
@DBBasePO(TableName = "dms_device_repair_record", Active = false, Name = false, Schemas = DBSchemas.AMS, CheckName =
        {"Code"}, CodeAuto = true
        , CodePrefix =
        "DRR-{yyyyMMdd}-", CodeNum = 4)
public class DMSDeviceRepairRecord extends BasePO {
    /**
     * 设备ID
     */
    @DBCondition
    @DBField
    public int DeviceID = 0;
    /**
     * 资产ID
     */
    @DBJoin(name = "AssetInfoID", tableName = "dms_device_ledger", tableAsName = "dms_device_ledger1", Schemas =
            DBSchemas.AMS,
            MainTableField = "DeviceID")
    public int AssetInfoID = 0;

    /**
     * 设备编码
     */
    @DBJoin(name = "Code", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,
            ConditionalJoin = "dms_device_ledger1.AssetInfoID=ams_asset_list1.ID")
    public String DeviceCode = "";
    /**
     * 设备名称
     */
    @DBJoin(name = "Name", tableName = "ams_asset_list", tableAsName = "ams_asset_list1", Schemas = DBSchemas.AMS,
            JoinIndex = 2,
            ConditionalJoin = "dms_device_ledger1.AssetInfoID=ams_asset_list1.ID")
    public String DeviceName = "";

    /**
     * 位置
     */
    @DBField
    public String Position = "";

    /**
     * 故障类别
     */
    @DBField
    public int FaultType = 0;
    /**
     * 故障类别文本
     */
    public String FaultTypeText = "";
    /**
     * 故障知识库ID
     */
    @DBField
    public int FaultBaseID = 0;
    /**
     * 故障代码
     */
    @DBJoin(name = "Code", tableName = "dms_fault_base", tableAsName = "dms_fault_base1", Schemas = DBSchemas.AMS,
            MainTableField = "FaultBaseID")
    public String FaultBaseCode = "";
    /**
     * 故障名称
     */
    @DBJoin(name = "Name", tableName = "dms_fault_base", tableAsName = "dms_fault_base1", Schemas = DBSchemas.AMS,
            MainTableField = "FaultBaseID")
    public String FaultBaseName = "";
    /**
     * 故障描述
     */
    @DBJoin(name = "Description", tableName = "dms_fault_base", tableAsName = "dms_fault_base1", Schemas =
            DBSchemas.AMS,
            MainTableField = "FaultBaseID")
    public String FaultBaseDescription = "";

    /**
     * 报修时间
     */
    @DBField
    public Calendar RepairTime = Calendar.getInstance();
    /**
     * 报修人ID
     */
    @DBField
    public int RepairApplicantID = 0;
    /**
     * 报修人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user1", Schemas = DBSchemas.Basic,
            MainTableField = "RepairApplicantID")
    public String RepairApplicantName = "";

    /**
     * 接收时间
     */
    @DBField
    public Calendar ReceptionTime = Calendar.getInstance();
    /**
     * 接收人ID
     */
    @DBField
    public int RecipientID = 0;
    /**
     * 接收人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user2", Schemas = DBSchemas.Basic,
            MainTableField = "RecipientID")
    public String RecipientName = "";

    /**
     * 到场时间
     */
    @DBField
    public Calendar ArrivalTime = Calendar.getInstance();

    /**
     * 处置人ID
     */
    @DBField
    public int DisposerID = 0;
    /**
     * 处置人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user3", Schemas = DBSchemas.Basic,
            MainTableField = "DisposerID")
    public String DisposerName = "";

    /**
     * 处置人班组
     */
    @DBField
    public int DisposerClassID = 0;

    /**
     * 部门ID
     */
    @DBJoin(name = "DepartmentID", tableName = "bms_classinfo", tableAsName = "bms_classinfo1", Schemas =
            DBSchemas.Basic,
            MainTableField = "DisposerClassID")
    public int DepartmentID = 0;

    /**
     * 处置人班组名称
     */
    @DBJoin(name = "Name", tableName = "bms_department", tableAsName = "bms_department1", Schemas = DBSchemas.Basic,
            JoinIndex = 2,
            ConditionalJoin = "bms_classinfo1.DepartmentID=bms_department1.ID")
    public String DisposerClassName = "";

    /**
     * 完工时间
     */
    @DBField
    public Calendar CompletionTime = Calendar.getInstance();

    /**
     * 状态
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.in)
    @DBField
    public int Status = 0;

    /**
     * 状态文本
     */
    public String StatusText = "";

    /**
     * 附件
     */
    @DBField
    public String AnnexUrl = "";

    /**
     * 设备报修流程ID
     */
    @DBCondition
    @DBField
    public int FaultBaseBPMID = 0;

    @JsonProperty("DeviceID")
    public int getDeviceID() {
        return DeviceID;
    }

    public void setDeviceID(int deviceID) {
        DeviceID = deviceID;
    }

    @JsonProperty("AssetInfoID")
    public int getAssetInfoID() {
        return AssetInfoID;
    }

    public void setAssetInfoID(int assetInfoID) {
        AssetInfoID = assetInfoID;
    }

    @JsonProperty("DeviceCode")
    public String getDeviceCode() {
        return DeviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        DeviceCode = deviceCode;
    }

    @JsonProperty("DeviceName")
    public String getDeviceName() {
        return DeviceName;
    }

    public void setDeviceName(String deviceName) {
        DeviceName = deviceName;
    }

    @JsonProperty("Position")
    public String getPosition() {
        return Position;
    }

    public void setPosition(String position) {
        Position = position;
    }

    @JsonProperty("FaultType")
    public int getFaultType() {
        return FaultType;
    }

    public void setFaultType(int faultType) {
        FaultType = faultType;
    }

    @JsonProperty("FaultTypeText")
    public String getFaultTypeText() {
        FaultTypeText = DMSFaultType.getEnumType(FaultType).getLabel();
        return FaultTypeText;
    }

    public void setFaultTypeText(String faultTypeText) {
        FaultTypeText = faultTypeText;
    }

    @JsonProperty("FaultBaseID")
    public int getFaultBaseID() {
        return FaultBaseID;
    }

    public void setFaultBaseID(int faultBaseID) {
        FaultBaseID = faultBaseID;
    }

    @JsonProperty("FaultBaseCode")
    public String getFaultBaseCode() {
        return FaultBaseCode;
    }

    public void setFaultBaseCode(String faultBaseCode) {
        FaultBaseCode = faultBaseCode;
    }

    @JsonProperty("FaultBaseName")
    public String getFaultBaseName() {
        return FaultBaseName;
    }

    public void setFaultBaseName(String faultBaseName) {
        FaultBaseName = faultBaseName;
    }

    @JsonProperty("FaultBaseDescription")
    public String getFaultBaseDescription() {
        return FaultBaseDescription;
    }

    public void setFaultBaseDescription(String faultBaseDescription) {
        FaultBaseDescription = faultBaseDescription;
    }

    @JsonProperty("RepairTime")
    public Calendar getRepairTime() {
        return RepairTime;
    }

    public void setRepairTime(Calendar repairTime) {
        RepairTime = repairTime;
    }

    @JsonProperty("RepairApplicantID")
    public int getRepairApplicantID() {
        return RepairApplicantID;
    }

    public void setRepairApplicantID(int repairApplicantID) {
        RepairApplicantID = repairApplicantID;
    }

    @JsonProperty("RepairApplicantName")
    public String getRepairApplicantName() {
        return RepairApplicantName;
    }

    public void setRepairApplicantName(String repairApplicantName) {
        RepairApplicantName = repairApplicantName;
    }

    @JsonProperty("ReceptionTime")
    public Calendar getReceptionTime() {
        return ReceptionTime;
    }

    public void setReceptionTime(Calendar receptionTime) {
        ReceptionTime = receptionTime;
    }

    @JsonProperty("RecipientID")
    public int getRecipientID() {
        return RecipientID;
    }

    public void setRecipientID(int recipientID) {
        RecipientID = recipientID;
    }

    @JsonProperty("RecipientName")
    public String getRecipientName() {
        return RecipientName;
    }

    public void setRecipientName(String recipientName) {
        RecipientName = recipientName;
    }

    @JsonProperty("ArrivalTime")
    public Calendar getArrivalTime() {
        return ArrivalTime;
    }

    public void setArrivalTime(Calendar arrivalTime) {
        ArrivalTime = arrivalTime;
    }

    @JsonProperty("DisposerID")
    public int getDisposerID() {
        return DisposerID;
    }

    public void setDisposerID(int disposerID) {
        DisposerID = disposerID;
    }

    @JsonProperty("DisposerName")
    public String getDisposerName() {
        return DisposerName;
    }

    public void setDisposerName(String disposerName) {
        DisposerName = disposerName;
    }

    @JsonProperty("DisposerClassID")
    public int getDisposerClassID() {
        return DisposerClassID;
    }

    public void setDisposerClassID(int disposerClassID) {
        DisposerClassID = disposerClassID;
    }

    @JsonProperty("DepartmentID")
    public int getDepartmentID() {
        return DepartmentID;
    }

    public void setDepartmentID(int departmentID) {
        DepartmentID = departmentID;
    }

    @JsonProperty("DisposerClassName")
    public String getDisposerClassName() {
        return DisposerClassName;
    }

    public void setDisposerClassName(String disposerClassName) {
        DisposerClassName = disposerClassName;
    }

    @JsonProperty("CompletionTime")
    public Calendar getCompletionTime() {
        return CompletionTime;
    }

    public void setCompletionTime(Calendar completionTime) {
        CompletionTime = completionTime;
    }

    @JsonProperty("Status")
    public int getStatus() {
        return Status;
    }

    public void setStatus(int status) {
        Status = status;
    }

    @JsonProperty("StatusText")
    public String getStatusText() {
        StatusText = DMSRepairRecordStatus.getEnumType(Status).getLabel();
        return StatusText;
    }

    public void setStatusText(String statusText) {
        StatusText = statusText;
    }

    @JsonProperty("AnnexUrl")
    public String getAnnexUrl() {
        return AnnexUrl;
    }

    public void setAnnexUrl(String annexUrl) {
        AnnexUrl = annexUrl;
    }

    @JsonProperty("FaultBaseBPMID")
    public int getFaultBaseBPMID() {
        return FaultBaseBPMID;
    }

    public void setFaultBaseBPMID(int faultBaseBPMID) {
        FaultBaseBPMID = faultBaseBPMID;
    }
}
